home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / fitPanel.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  4.6 KB  |  158 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. // Alias|Wavefront Script File MODIFY THIS AT YOUR OWN RISK
  18. //
  19. //  Creation Date:  30 July 1996
  20. //  Author:         cdt
  21. //
  22. //
  23. //  Procedure Name:
  24. //      fitPanel
  25. //
  26. //  Description:
  27. //        Procedure to do a view fit in the pane under the
  28. //        pointer. Currently this script can be used on model and graph
  29. //        panes, and the view can be fit to either selected or all
  30. //        objects depending on the fitType argument.
  31. //
  32. //        Only one panel will be affected by this operation.
  33. //
  34. //  Input Arguments:
  35. //      fitType can be either "-all" or "-selected".
  36. //
  37. //  Return Value:
  38. //      None.
  39. //
  40.  
  41. global proc fitPanel ( string $fitType )
  42. {
  43.     string $panel = `getPanel -up`;
  44.  
  45.     //    Bug fix #138175. Problems arise when using the Hotbox.
  46.     //    The cursor may not actually be over a panel. And on Irix
  47.     //    the `getPanel -underPointer` command returns empty string 
  48.     //    when Hotbox    is up. The fix is to do a secondary test for 
  49.     //    the panel with focus.
  50.     //    
  51.     if ("" == $panel) {
  52.         $panel = `getPanel -withFocus`;
  53.     }
  54.  
  55.     if ($panel != "") {
  56.         string $type = `getPanel -to $panel`;
  57.  
  58.         if ($type == "modelPanel") {
  59.  
  60.             if ( `optionVar -exists animateRoll` )
  61.             {
  62.                 // If you use animate roll 
  63.                 int $animate = 0;
  64.                 $animate = `optionVar -q animateRoll`;
  65.  
  66.                 if ($fitType == "-all")
  67.                     viewFit -all -animate $animate `lookThru -q $panel`;
  68.                 else
  69.                     viewFit -animate $animate `lookThru -q $panel`;
  70.             }
  71.             else
  72.             {
  73.                 // Maya doesn't use animateRoll 
  74.                 if ($fitType == "-all")
  75.                     viewFit -all `lookThru -q $panel`;
  76.                 else
  77.                     viewFit `lookThru -q $panel`;
  78.             }
  79.         }
  80.         else if ($type == "hyperPanel") {
  81.             if ($fitType == "-all")
  82.                 hyperGraph -e -frameGraph $panel;
  83.             else
  84.                 hyperGraph -e -frame $panel;
  85.         }
  86.         else if ($type == "outlinerPanel") {
  87.             // It is kind of tough for the outliner to do show-all
  88.             // so just always do a show-selected
  89.             //
  90.             outlinerEditor -edit -showSelected true $panel;
  91.         }
  92.         else if ($type == "scriptedPanel") {
  93.             string $scriptedType = `scriptedPanel -q -type $panel`;
  94.             switch ($scriptedType) {
  95.             case "graphEditor":
  96.                 string $graphEd = ($panel+"GraphEd");
  97.                 if ($fitType == "-all") {
  98.                     animCurveEditor -e -lookAt all $graphEd;
  99.                 } else {
  100.                     animCurveEditor -e -lookAt selected $graphEd;
  101.                 }
  102.                 break;
  103.             case "hyperGraphPanel":
  104.                 string $hyperGraphEd = ( $panel + "HyperGraphEd");
  105.                 if ($fitType == "-all") {
  106.                     hyperGraph -e -frameGraph $hyperGraphEd;
  107.                 } else {
  108.                     hyperGraph -e -frame $hyperGraphEd;
  109.                 }
  110.                 break;
  111.             case "hyperShadePanel":
  112.                 if ($fitType == "-all") {
  113.                     hyperShadePanelFrameAll($panel);
  114.                 } else {
  115.                     hyperShadePanelFrameSelected($panel);
  116.                 }
  117.                 break;
  118.                case "miInteractionEditorPanel":
  119.                 if (`pluginInfo -q -l MayaInteractive`){
  120.                      miInteractionEditorPanelFrame( $panel, $fitType );
  121.                 }
  122.                 break;
  123.             case "visorPanel":
  124.                 if ($fitType == "-all") {
  125.                     visorPanelFrameAll($panel);
  126.                 } else {
  127.                     visorPanelFrameSelected($panel);
  128.                 }
  129.                 break;
  130.             case "dopeSheetPanel":
  131.                 string $dopeSheetEd = ( $panel + "DopeSheetEd" );
  132.                 if( $fitType == "-all" ) {
  133.                     dopeSheetEditor -edit -lookAt all $dopeSheetEd;
  134.                 } else {
  135.                     dopeSheetEditor -edit -lookAt selected $dopeSheetEd;
  136.                 }
  137.                 break;
  138.             case "polyTexturePlacementPanel":
  139.                 string $texWindowEd = $panel;
  140.                 if( $fitType == "-all" ) {
  141.                     textureWindow -edit -frameAll $texWindowEd;
  142.                 } else {
  143.                     textureWindow -edit -frameSelected $texWindowEd;
  144.                 }
  145.                 break;
  146.             case "clipEditorPanel":
  147.                 string $traxWindowEd = ( $panel + "ClipEditor" );
  148.                 if( $fitType == "-all" ) {
  149.                     clipEditor -edit -frameAll $traxWindowEd;
  150.                 } else {
  151.                     clipEditor -edit -frameAll $traxWindowEd;
  152.                 }
  153.                 break;
  154.             }
  155.         }
  156.     }
  157. }
  158.